\documentclass[UTF8]{ctexart}
\usepackage{listings} 
\usepackage{xcolor}
\usepackage{fancyhdr}%设置页脚页眉需要的包
\pagestyle{fancy}
\usepackage{graphicx}
\usepackage{cite}
\usepackage{tikz}
\usepackage{booktabs}
\usepackage{float}
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{xeCJK}
\usepackage{graphicx}
\usepackage{fullpage}
\usepackage{gnuplottex}
\usepackage{geometry}
\usepackage{enumitem}
\usepackage{verbatimbox}
\usepackage{amsfonts,amssymb} 
\usepackage[ruled,linesnumbered]{algorithm2e}
\usepackage[colorlinks,linkcolor=blue,citecolor=blue]{hyperref}
\usepackage{cite}
\CTEXsetup[format={\Large\bfseries}]{section}
\newtheorem{example}{例}             % 整体编号
\newtheorem{theorem}{定理}[section]  % 按 section 编号
\newtheorem{definition}{定义}
\newtheorem{axiom}{公理}
\newtheorem{property}{性质}
\newtheorem{proposition}{命题}
\newtheorem{lemma}{引理}
\newtheorem{corollary}{推论}
\newtheorem{remark}{注解}
\newtheorem{condition}{条件}
\newtheorem{conclusion}{结论}
\newtheorem{assumption}{假设}
\newcommand{\enabstractname}{Abstract}
\newenvironment{enabstract}{%
    \par\small
    \noindent\mbox{}\hfill{\bfseries \enabstractname}\hfill\mbox{}\par
    \vskip 2.5ex}{\par\vskip 2.5ex}
\usetikzlibrary{positioning, shapes.geometric}
\lstset{
  language=C++,
  frame=shadowbox,
  rulesepcolor=\color{red!20!green!20!blue!20},
  keywordstyle=\color{blue!90}\bfseries,
  commentstyle=\color{red!10!green!70}\textit,
  showstringspaces=false,
  numbers=left,
  numberstyle=\tiny,
  stringstyle=\ttfamily,
  breaklines=true,
  extendedchars=false,
  texcl=true}

\title{Programming Assignment I}

\author{韩骐骏 \\ (数学科学学院)信息与计算科学3200103585}

\begin{document}

\maketitle

\section{Problem 1.8.2 B}
\subsection{Problem Description}
Test your implementation of the bisection method on the following functions and intervals.\\
\subsection{$\frac{1}{x}-\tan x$ on $[0,\frac{\pi}{2}]$}
The iterations is $52$. The root $r=0.860334$. Now $f(r)=0$0.\\

\subsection{$\frac{1}{x}-2^x$ on $[0,1]$}
The iterations is $52$. The root $r=0.641186$. Now $f(r)=0$.\\

\subsection{$2^-^x+e^x+2\cos x-6$ on $[1,3]$}
The iterations is $53$. The root $r=1.82938$. Now $f(r)=0$.\\

\subsection{$\frac{x^3+4x^2+3x+5}{2x^3-9x^2+18x-2}$ on $[0,4]$}
The iterations is $56$. The root $r=0.117877$. Now $f(r)=6.09207*10^1^5$.\\

\section{Problem 1.8.2 C}
\subsection{Problem Description}
Test your implementation of Newton’s method by solving $x=\tan x$. Find the roots near $4.5$ and $7.7$.\\
\subsection{$x_{\mbox{\scriptsize 0}}=4.5$}
The iterations is $10001$.The root $r=4.49341$. Now $f(r)=-8.88178*10^-^1^6$.\\
\subsection{$x_{\mbox{\scriptsize 0}}=7.7$}
The iterations is $10001$.The root $r=7.72525$. Now $f(r)=2.30926*10^-^1^4$.\\

\section{Problem 1.8.2 D}
\subsection{Problem Description}
Test your implementation of the secant method by the following functions and initial values.\\

\subsection{$\sin (\frac{x}{2})-1$ with $x_{\mbox{\scriptsize 0}}=0,x_{\mbox{\scriptsize 1}}=\frac{\pi}{2}$}
The iterations is $36$. The root $r=3.14159$. Now $f(r)=-1.11022*10^-^1^6$.\\

\subsection{$e^x-\tan x$ with $x_{\mbox{\scriptsize 0}}=1,x_{\mbox{\scriptsize 1}}=1.4$}
The iterations is $15$. The root $r=1.30633$. Now $f(r)=-8.88178*10^-^1^6$.\\

\subsection{$x^3-12x^2+3x+1$ with $x_{\mbox{\scriptsize 0}}=0,x_{\mbox{\scriptsize 1}}=-0.5$}
The iterations is $7$. The root $r=-0.188685$. Now $f(r)=0$.\\

\section{Problem 1.8.2 E}
\subsection{Problem Description}
As shown below, a trough of length $L$ has a cross section in the shape of a semi-circle with radius $r$. When filled to within a distance $h$ of the top, the water has the volume $$V=L[0.5\pi r^2-r^2\arcsin (\frac{h}{r})-h(r^2-h^2)^0^.^5]$$Suppose $L=10ft, r=1ft, V=12.4ft^3$
. Find the depth of water in the trough to within $0.01ft$ by each of the three implementations in $A$.

\subsection{Solution: Bisection method}
The iterations is $53$. The root $r=0.166166$. Now $f(r)=0$.\\

\subsection{Solution: Newton method}
The iterations is $6$. The root $r=0.166166$. Now $f(r)=0$.\\

\subsection{Solution: Secant method}
The iterations is $4$. The root $r=0.166166$. Now $f(r)=0$.\\

\section{Problem 1.8.2 F}
\subsection{Problem Description}
Temporarily omitted.\\

\subsection{a}
Use Newton’s method to verify $\alpha=33^{\circ}。$ when $l=89in., h=49in., D=55in., \beta_{\mbox{\scriptsize 1}}=11.5^{\circ}$.\\
The iterations is $7$.The root $r=0.575473$. Now $f(r)=0$.In fact $\frac{33\pi}{180}\approx 0.575958653158$. Thus the result is convincing.\\

\subsection{b}
Use Newton’s method to find $\alpha$ with the initial guess $33^{\circ}$ for the situation when $l, h, \beta_{\mbox{\scriptsize 1}}$ are the same as in part ($a$) but $D=30in.$.\\
The iterations is $1000$.The root $r=0.578907$. Now $f(r)=3.55271*10^-^1^5$.\\

\subsection{c}
Use the secant method (with another initial value as far away as possbile from $33^{\circ}$) to find $\alpha$. Show that you get a different result if the initial value is too far away from $33^{\circ}$; discuss the reasons.\\
As we set $x_{\mbox{\scriptsize 0}}=0, x_{\mbox{\scriptsize 1}}=\frac{\pi}{3}$. The iterations is $10$. The root $r=-0.200713$. Now $f(r)=0$. However, the answer $r=-0.200713$ is absolutely wrong. The reason is that this equation has more than one zero point. When the set initial point is far away from the correct root, the final iterative solution will be another root, but that does not conform to the reality.\\

\end{document}
